#include "Including.h"

using namespace std;

typedef unsigned int Marker;

namespace MemoryManagement{

	list<unsigned int> * markerList;

	void *MyMemoryManagement::operator new(unsigned int size)
	{
		void *store = malloc(size);
		return store;
	}

	void MyMemoryManagement::operator delete(void *p) {}
	

	void *MyMemoryManagement::allocate(unsigned int size)
	{
		int temp = markerList->back();
		temp = temp + size;
		markerList->push_back(temp);
		return (void *)markerList->back();				
	}
	
	void MyMemoryManagement::deallocate(void *pt)
	{
		free(pt);
		pt = NULL;
	}

	int MyMemoryManagement::getMaker()
	{
		return markerList->back();
	}

	void MyMemoryManagement::freeToMarker()
	{
		markerList->pop_back();
	}

}
